<!DOCTYPE html>
<html>
<head>
<title>佳怡供应链金融</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1, user-scalable=no">

<meta name="description"
	content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
">

<!-- <link rel="stylesheet" href="../lib/weui.min.css">
    <link rel="stylesheet" href="../css/jquery-weui.css">
    <link rel="stylesheet" href="css/demos.css">-->
<link rel="stylesheet" href="lib/weui.min.css">
<link rel="stylesheet" href="css/jquery-weui.css">
<link rel="stylesheet" href="demos/css/demos.css">
<link rel="stylesheet" href="font/fontscss/iconfont.css">
<link rel="stylesheet" href="css/common.css">


	<link rel="stylesheet" href="lib/weui.min.css">
	<link rel="stylesheet" href="css/jquery-weui.css">
	<link rel="stylesheet" href="demos/css/demos.css">
	<link rel="stylesheet" href="font/fontscss/iconfont.css">
	<link rel="stylesheet" href="css/common.css">

<style type="text/css">
.weui-cells {
	padding-top: 0px;
	margin-top: 0;
	background-color: #eee;

	/*
                        padding: 10px 7px;
            */
}

.weui-cell {
	padding: 0px;
}

.weui-check__label {
	display: block;
}

.weui-cells_checkbox .weui-cell__hd {
	width: 8%;
	float: left;
}

.weui-cells {
	margin-top: -2.2rem;
	margin-bottom: 2.6rem;
	/* position: fixed; */
}

.weui-row {
	font-size: 10px;
}

.weui-btn_mini {
	float: right;
	position: fixed;
	left: 78%;
	top: 40%;
}

.weui-loadmore {
	width: 65%;
	margin: 1.5em auto;
	line-height: 1.6em;
	font-size: 14px;
	text-align: center;
}

.sp_split {
	height: 0.3rem;
	border-top: 1px solid #ececec;
	border-bottom: 1px solid #ececec;
	background: #f3f3f3;
}
.sp_title{
	margin-left: 1rem;
    font-size: 0.7rem;
    line-height: 1.8rem;
}
.div_title{
	background-color: #ffffff;
    height: 1.7rem;
    border-bottom: 1px solid #ececec;
}
.div_mess{
	text-align: center;
    float: left;
    width: 43.22%;
    height: 100%;
    position: relative;
    background-color: #ffffff;
}
.time {
	text-align: center;
}

.time_left {
	width: 50%;
	display: inline-block;
	line-height: 1.5rem;
}

.span1 {
	font-size: 14px;
	opacity: 0.6;
}

.span2 {
	font-size: 14px;
	opacity: 0.6;
}

.time_left span {
	display: block;
}

.time_right {
	width: 48%;
	float: left;
	line-height: 1.5rem;
}

.time_right span {
	display: block;
}


</style>
<script src="lib/jquery-2.1.4.js"></script>
<script src="js/circleProgress.js"></script>
<script src="js/jquery-weui.js"></script>

<script>
	var size = 0;
	var ids = new Array();
	var loading = false;
	$(function() {
		addupload();
		loadProData();
		$("[name='checkbox1']").change(function() { 
			alert("checked"); 
		});


        $.ajax({
            url: "rzRelease/getTaskMoneyCount",
            type: "post",
            async: "false",
			data: { token: localStorage.getItem("token")},
            success: function (msg) {

                $("#pro_size1").html(msg);
                $("#pro_size1").attr("val",msg);
            }
        })




      /* window.setInterval(function(){
            checkUserOnline();
		},2000);*/

	});

    /*function checkUserOnline() {
        $.ajax({
            url: "login/getSession",
            type: "post",
            async: "false",
            // data: { token: localStorage.getItem("token")},
            success: function (msg) {
                if(msg!=""&&msg!=null){
                    $.alert("您的账号已经在另一处登录，您被迫下线！","警告", function() {
                        window.location.href="login.html"
                    });

                }

               /!* alert(msg);
                window.location.href="login.html"*!/
            }
        })
    }*/
    function checkLogin(){
        int = setInterval("checkUserOnline()",3600);
    }

    function addupload() {
		var pro_in = localStorage.getItem("pro_info");
		if (pro_in != '' && pro_in != null) {
			ids = pro_in.split(",");
		}
		size=0;
		$("#pro_size").html(ids.length);
		$("#pro_size").attr("val", ids.length);
		$("#download").show();
	}
	function loadProData() {
		$.ajax({
			url : "productRelease/getInvest",
			type : "post",
			async : "false",
			data : {
				start : size * 1,
				length : 4
			},
			success : function(msg) {
				var data = JSON.parse(msg);
				if(data.length==0){
					$("#download").hide();
				}
				size = size + data.length;
				for (var i = 0; i < data.length; i++) {
					var pro = data[i];
                    var syls=pro["yield"]*100;
					/*var syls=pro["yield"].toString().split(".");
					if(syls!=null && syls.length<2){
						syls[1]='0';
					}*/
					$("#pro_div").append(
						'<label class="weui-cell weui-check__label" for="' + pro.id + '">'
						+'	<div class="sp_split"></div>'
						+'	<div>'
						+'		<div class="div_title">'
						+'			<input type="checkbox" class="weui-check" name="checkbox1" onclick="pro(this,\''+ pro.end_time+'\')" id="' + pro.id + '" />'
						+'			<i class="weui-icon-checked" style="line-height: 0;"></i>'
						+'			<span class="sp_title">' + pro.product_name +'</span>'
						+'		</div>'


                        +'<div class=\"time\">'
                        +'  <div class=\"time_left\">'
                        +'   <span class=\"span1\">'+ pro.end_time+'</span>'
                        +'<span class=\"span2\">投资结束时间</span>'
                        +'</div>'
                        +' <div class=\"time_right\">'
                        +' <span class=\"span1\">'+pro.start_time+'</span>'
                        +'<span class=\"span2\">投资开始时间</span>'
                        +'</div>'
                        +'</div>'

						+'		<div style="height: 4.5rem; width: 100%;">'
						+'			<div style="float:left;text-align: center; width:33.6%;background-color: #ffffff;">'
						+'				<p style="height: 3rem;width: 100%;">'
						+'					<span style="font-size: 2rem;color: #f45a3f;">'+syls+'</span>'
						/* +'					<span style="font-size: 1rem;color: #f45a3f;">.'+syls[1]+'</span>'*/
						+'					<span style="font-size: 0.8rem;color: #f45a3f;">%</span>'
						+'				</p>'
						+'				<p style="font-size: 0.6rem;color: #999999;height: 1.5rem;">预期年化率</p>'
						+'			</div>'
						+'			<div class="div_mess">'
						+'				<img src="./images/line2.png" style="position: absolute;top: 0.5rem;left: 0.5rem; text-align: center;float: left;height: 80%;">'
						+'				<p style="font-size: 0.8rem;color: #9096a0;    height: 2rem;line-height: 2rem;"><span style="margin-right: 1rem;">'+pro.diff+'个月</span><span>50000起投</span></p>'
						+'				<p style="font-size: 0.7rem;text-align: left;padding-left: 10%;color: #999999; padding-top: 13%;"><span>剩余'+pro.money+'</span></p>'
						+'			</div>'
						+'			<div class="weui-col-25" style="float: left; width: 23.1%; height: 100%;background-color: #ffffff;">'
						+'				<canvas id="p'+pro.id+'" style="padding-top: 15%" width="65" height="65"></canvas>'
						+'			</div>'
						+'		</div>'
						+'	</div>'
						+'</label>'
					);
					for (var j = 0; j < ids.length; j++) {
						if (ids[j] == pro.id) {
							$("#" + ids[j])[0].checked = true;
						}
					}
					circleProgress({
						id : 'p'+pro.id,
						progress : parseInt(pro.syl), // default: 100
						duration :500, // default: 1000
						color : 'rgb(251, 137, 53)',
						bgColor : 'rgb(237, 237, 237)',
						textColor : '#fb8935',
						progressWidth : 0.05, // default: 0.25 (r)
						fontScale : 0.5, // default: 0.4 (r)
						toFixed : 1 // default: 0
					});
				}
			}
		});
	}
	function click2() {
		$.ajax({
			url : "http://192.168.5.19:8101/Clarify/app.do",
			type : "post",
			/* dataType:"JSONP",
			jsonpCallback:"json",
			crossDomain: true, */
			data : {
				method : "Clarify",
				json : "哈哈哈哈"
			},
			success : function(mes) {
				console.log("返回了" + mes);
			}
		});
	}
	function pro(check,end_time) {
        var now = new Date();
        var end = new Date(end_time);
   if(now.getTime()>end.getTime()){
       $.toast("投资时间以过期，请选择其他项目进行投资");
       $(check)[0].checked = false
   }else {
    var id = $(check).attr("id");
    var num = $("#pro_size").attr("val");
    if ($(check)[0].checked == true) {
        ids.push(id);
        num++;
    } else {
        for (var i = 0; i < ids.length; i++) {
            if (ids[i] == id) {
                ids.splice(i, 1);
                break;
            }
        }
        num--;
    }
    $("#pro_size").html(num);
    $("#pro_size").attr("val", num);
    localStorage.setItem("pro_info", ids);
}
	}
</script>
</head>

<body  ontouchstart >
	<header style="position: fixed;">
		<div class="weui-row weui-no-gutter">
			<div class="weui-col-33" id="back_icon">
				<a href="javascript:history.go(-1)" class="icon pull-right"><i
					class="icon_back"></i></a>
			</div>
			<div class="weui-col-33">投资</div>
			<div class="weui-col-33" id="ligin_icon">
				<!-- <a href="login.html" class="icon pull-right"><i class="iconfont icon-wode"></i></a> -->
			</div>
		</div>
	</header>
	<div class="weui-cells weui-cells_checkbox" id="inv_div">
		<div>
			<div class="weui-pull-to-refresh__layer">
	            <div class='weui-pull-to-refresh__arrow'></div>
	            <div class='weui-pull-to-refresh__preloader'></div>
	            <div class="down">下拉刷新</div>
	            <div class="up">释放刷新</div>
	            <div class="refresh">正在刷新</div>
        	</div>
        	<ul id="pro_div">
			</ul>
			<div class="weui-loadmore" id="download">
				<i class="weui-loading"></i> <span class="weui-loadmore__tips">正在加载</span>
			</div>
		</div>
	</div>
	<a href="javascript:;" onclick="pro_ship_cart()"
		class="weui-btn weui-btn_mini weui-btn_primary" style="width: 4rem;padding-left: 0rem;padding-right: 0%;"><i
		class="iconfont icon-cart"></i> <span class="weui-badge" id="pro_size"
		val="0" style="position: absolute;right: 3rem;">0</span>投资</a>
	<div class="weui-tabbar">
		<!--<a href="touzi.html" class="weui-tabbar__item iconcheck"> &lt;!&ndash;
        <span class="weui-badge" style="position: absolute;top: -.4em;right: 1em;">8</span>
&ndash;&gt;
			<div class="weui-tabbar__icon">
				<i class="iconfont icon-wodedingdan"></i>
			</div>
			<p class="weui-tabbar__label">投资</p>
		</a> <a href="touzi.html" class="weui-tabbar__item">
			<div class="weui-tabbar__icon">
				<i class="iconfont icon-edit"></i>
			</div>
			<p class="weui-tabbar__label">申请</p>
		</a> <a href="user.html" class="weui-tabbar__item">
			<div class="weui-tabbar__icon">
				<i class="iconfont icon-account"></i>
			</div>
			<p class="weui-tabbar__label">我的</p>
		</a>-->
	</div>
<script src="js/web/touzi.js"></script>
	<script src="js/web/checkLogin.js"></script>
	<script type="text/javascript">

	</script>
</body>
</html>
